﻿using System;
using System.Collections.Generic;
using System.Text;


namespace Project1
{
    class PigLatin
    {        
        static void Main(string[] args)
        {
            PigLatin p = new PigLatin();
            string sentence;
            Console.WriteLine("Welcome to the Pig Latin translator! Type in a sentence!!");
            sentence = Console.ReadLine();

            foreach(string word in sentence.Split())
            {
                string firstLetter = word.Substring(0,1);
                string restOfTheWord = word.Substring(1,word.Length - 1);
                bool doesHaveVowel = p.isVowel(firstLetter,word);
                if( doesHaveVowel == true)
                {
                    Console.Write(restOfTheWord+firstLetter+"ay ");
                }
                else
                {
                    Console.Write(firstLetter+restOfTheWord+"way ");
                }

            }
            Console.ReadLine();
        }
        public bool isVowel(string firstLetter, string word)
        {
            string[] vowels = { "a", "e", "i", "o", "u" };

            int vowelIndex = word.IndexOf(firstLetter.ToLower());

            if (vowelIndex == -1)
            {
                return false;
            }
            else
                return true;
        }
       
    }
}
